package com.haoxuer.discover.site.data.entity;

import com.haoxuer.discover.data.entity.CatalogEntity;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 链接分类
 * <p>
 * Created by ada on 2017/6/7.
 */


@Entity
@Table(name = "site_link_type")
public class LinkType extends CatalogEntity {
  
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "pid")
  private LinkType parent;
  
  @Override
  public Integer getParentId() {
    if (parent != null) {
      return parent.getId();
    }
    return null;
  }
  
  public LinkType getParent() {
    return parent;
  }
  
  public void setParent(LinkType parent) {
    this.parent = parent;
  }
}
